

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CommonUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nickyName', models.CharField(blank=True, max_length=50, verbose_name='昵称')),
                ('cate', models.BooleanField(default=False, verbose_name='类别')),
                ('faculty', models.CharField(blank=True, default='undefine', max_length=20, verbose_name='系别')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '学生信息表',
                'verbose_name_plural': '学生信息表',
                'db_table': 'common_user',
            },
        ),
        migrations.CreateModel(
            name='Doc',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file_name', models.CharField(max_length=50, verbose_name='文件名字')),
                ('file_path', models.CharField(max_length=100, verbose_name='文件路径')),
                ('file_obj', models.FileField(upload_to='files/', verbose_name='文件')),
                ('upload_time', models.DateTimeField(auto_now_add=True, verbose_name='借用时间')),
            ],
            options={
                'verbose_name': '文件信息表',
                'verbose_name_plural': '文件信息表',
                'db_table': 'doc',
            },
        ),
        migrations.CreateModel(
            name='Instrument',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ins_no', models.CharField(max_length=13, unique=True, verbose_name='仪器编号')),
                ('ins_name', models.CharField(max_length=200, verbose_name='仪器名称')),
                ('ins_detail', models.TextField(blank=True, max_length=2000, verbose_name='仪器信息')),
                ('ins_nowtotal', models.IntegerField(default=0, verbose_name='仪器剩余数')),
                ('ins_bototal', models.IntegerField(default=0, verbose_name='仪器借用数')),
            ],
            options={
                'verbose_name': '仪器信息表',
                'verbose_name_plural': '仪器信息表',
                'db_table': 'instrument',
                'ordering': ('ins_no',),
            },
        ),
        migrations.CreateModel(
            name='Lab',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, verbose_name='实验室名称')),
                ('description', models.TextField(blank=True, verbose_name='实验室简介')),
            ],
            options={
                'verbose_name': '实验室信息表',
                'verbose_name_plural': '实验室信息表',
                'db_table': 'lab',
            },
        ),
        migrations.CreateModel(
            name='Medicine',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=13, unique=True, verbose_name='药品编号')),
                ('name', models.CharField(max_length=200, verbose_name='药品名')),
                ('detail', models.TextField(blank=True, max_length=2000, verbose_name='药品信息')),
                ('nowtotal', models.IntegerField(default=0, verbose_name='药品剩余量')),
                ('usedtotal', models.IntegerField(default=0, verbose_name='药品用量')),
                ('riskfactor', models.IntegerField(default=0, verbose_name='风险因子')),
            ],
            options={
                'verbose_name': '药品信息表',
                'verbose_name_plural': '药品信息表',
                'db_table': 'medicine',
                'ordering': ('number',),
            },
        ),
        migrations.CreateModel(
            name='InsBorrow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ins_boNum', models.PositiveIntegerField(default=0, verbose_name='借用数量')),
                ('ins_boDate', models.DateTimeField(auto_now_add=True, verbose_name='借用时间')),
                ('ins_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.CommonUser', verbose_name='借用人')),
                ('instrument', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.Instrument', verbose_name='借用仪器')),
            ],
            options={
                'verbose_name': '借用仪器记录',
                'verbose_name_plural': '借用仪器记录',
                'db_table': 'ins_borrow',
            },
        ),
        migrations.CreateModel(
            name='Borrow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('medicineUsedNum', models.PositiveIntegerField(default=0, verbose_name='药品使用量(/g)')),
                ('boDate', models.DateTimeField(auto_now_add=True, verbose_name='借用时间')),
                ('lab', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.Lab', verbose_name='借用地点')),
                ('medicine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.Medicine', verbose_name='借用药品')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.CommonUser', verbose_name='借用人')),
            ],
            options={
                'verbose_name': '借用药品记录表',
                'verbose_name_plural': '借用药品记录表',
                'db_table': 'borrow',
            },
        ),
    ]
